<ion-header-bar class="bar-top item-input-inset">
    <div class="buttons">
        <nav-button class="back" ng-click="back()"></nav-button>
    </div>
    <label class="item-input-wrapper">
      <i class="icon ion-ios-search placeholder-icon"></i>
      <input type="search" placeholder="请输入医生名称" ng-model="vm.conditions.condition" ng-keydown="vm.keywordSearch($event)">
    </label>
</ion-header-bar>
<ion-view>
    <ion-content class="doc doc-list" scroll="false">
        <div class="search-box">
            <div class="row">
                <div class="col col-50" ng-class="{'selected':vm.flag==1}" ng-click="vm.menu(1)">
                    <span>科室</span><i class="down"></i>
                </div>
                <div class="col col-50" ng-class="{'selected':vm.flag==2}" ng-click="vm.menu(2)">
                    <span>排序</span><i class="down"></i>
                </div>
            </div>
            <ion-list ng-if="vm.flag==1" ng-cloak class="ng-cloak">
                <ion-scroll>
                    <ion-item ng-click="vm.departSearch(0)" ng-class="{'selected':!vm.conditions.branchId}"><span>全部科室</span></ion-item>
                    <ion-item ng-repeat="depart in vm.departs" ng-click="vm.departSearch(depart.id)" ng-class="{'selected':vm.conditions.branchId==depart.id}"><span ng-bind="depart.name"></span></ion-item>
                </ion-scroll>
                
            </ion-list>
            <ion-list ng-if="vm.flag==2" ng-cloak class="ng-cloak">
                <ion-scroll>
                    <ion-item  ng-class="{'selected':vm.conditions.sorter=='intelligent'}" ng-click="vm.sort('intelligent', 'asc')"><span>智能排序</span></ion-item>
                    <ion-item  ng-class="{'selected':vm.conditions.sorter=='name'}" ng-click="vm.sort('name', 'asc')"><span>医生姓名</span></ion-item>
                    <ion-item  ng-class="{'selected':vm.conditions.sorter=='hospitalName'}" ng-click="vm.sort('hospitalName', 'asc')"><span>医院姓名</span></ion-item>
                </ion-scroll>
            </ion-list>
        </div>
        <div class="doc-box " ng-class="{'open-search': vm.flag}">
            <div class="shadow"></div>
            <ion-scroll>
                <ion-refresher
                    pulling-text="下拉刷新"
                    on-refresh="vm.doRefresh()">
                  </ion-refresher>
                <ion-list class="clinics">
                    <ion-item ng-repeat="doc in vm.docs" ng-click="vm.toDetail(doc.id,doc.name)">
                        <div class="row">
                            <div class="col col-33 avatar">
                                <img ng-src="{{downloadImg(doc.headImgUrl)}}" alt="">
                            </div>
                            <div class="col col-67 info">
                                <p class="t1"><span class="name" ng-bind="doc.name"></span><span ng-bind="doc.branchName"></span> <span ng-bind="doc.titleName"></span></p>
                                <p class="t"><span ng-bind="doc.hospitalName"></span><button class="status " ng-class="{'online': doc.isOnline==1}" ng-bind="(doc.isOnline==1?'在线':'离线')"></button></p>
                                <p class="t" ng-bind="doc.specialty"></p>
                            </div>
                        </div>
                    </ion-item>
                </ion-list>
                <ion-infinite-scroll
                    ng-if="!vm.nodata"
                    on-infinite="vm.loadMore()"
                    distance="1%">
                  </ion-infinite-scroll>
            </ion-scroll>
        </div>
    </ion-content>
</ion-view>